package com.yinhe.system.service.impl;

import com.yinhe.common.annotation.DataScope;
import com.yinhe.common.utils.DateUtils;
import com.yinhe.system.domain.YhVacation;
import com.yinhe.system.mapper.YhVacationMapper;
import com.yinhe.system.service.IYhVacationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 休假记录Service业务层处理
 * 
 * @author yinhe
 * @date 2022-09-04
 */
@Service
public class YhVacationServiceImpl implements IYhVacationService 
{
    @Autowired
    private YhVacationMapper yhVacationMapper;

    /**
     * 查询休假记录
     * 
     * @param id 休假记录主键
     * @return 休假记录
     */
    @Override
    public YhVacation selectYhVacationById(Long id)
    {
        return yhVacationMapper.selectYhVacationById(id);
    }

    /**
     * 查询休假记录列表
     * 
     * @param yhVacation 休假记录
     * @return 休假记录
     */
    @Override
    @DataScope(deptAlias = "L", userAlias = "L")
    public List<YhVacation> selectYhVacationList(YhVacation yhVacation)
    {
        return yhVacationMapper.selectYhVacationList(yhVacation);
    }

    /**
     * 新增休假记录
     * 
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int insertYhVacation(YhVacation yhVacation)
    {
        yhVacation.setCreateTime(DateUtils.getNowDate());
        return yhVacationMapper.insertYhVacation(yhVacation);
    }

    /**
     * 修改休假记录
     * 
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int updateYhVacation(YhVacation yhVacation)
    {
        yhVacation.setUpdateTime(DateUtils.getNowDate());
        return yhVacationMapper.updateYhVacation(yhVacation);
    }

    /**
     * 批量删除休假记录
     * 
     * @param ids 需要删除的休假记录主键
     * @return 结果
     */
    @Override
    public int deleteYhVacationByIds(Long[] ids)
    {
        return yhVacationMapper.deleteYhVacationByIds(ids);
    }

    /**
     * 删除休假记录信息
     * 
     * @param id 休假记录主键
     * @return 结果
     */
    @Override
    public int deleteYhVacationById(Long id)
    {
        return yhVacationMapper.deleteYhVacationById(id);
    }
    /**
     * 阅知休假记录
     *
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int viewYhVacation(YhVacation yhVacation) {
        return yhVacationMapper.viewYhVacation(yhVacation);
    }
    /**
     * 局长阅知休假记录
     *
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int chiefYhVacation(YhVacation yhVacation) {
        return yhVacationMapper.chiefYhVacation(yhVacation);
    }
    /**
     * 政委阅知休假记录
     *
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int gaottYhVacation(YhVacation yhVacation) {
        return yhVacationMapper.gaottYhVacation(yhVacation);
    }
    /**
     * 销假记录
     *
     * @param yhVacation 休假记录
     * @return 结果
     */
    @Override
    public int backYhVacation(YhVacation yhVacation) {
        return yhVacationMapper.backYhVacation(yhVacation);
    }
}
